package com.richard.main.ui.fragment

import androidx.viewpager.widget.ViewPager
import com.ashokvarma.bottomnavigation.BottomNavigationBar
import com.ashokvarma.bottomnavigation.BottomNavigationItem
import com.richard.base.ui.BaseVMFragment
import com.richard.main.R
import com.richard.main.ui.adapter.MainPagerAdapter
import com.richard.main.ui.manager.MainTabManager
import com.richard.main.viewModel.MainTabViewModelImpl
import kotlinx.android.synthetic.main.main_tab_fragment.*
import org.koin.android.viewmodel.ext.android.getViewModel


class MainTabFragment : BaseVMFragment<MainTabViewModelImpl>() {


    companion object {
        fun newInstance() = MainTabFragment()
    }

    override fun initVm(): MainTabViewModelImpl {
        return getViewModel()
    }

    override fun getLayoutResId() = R.layout.main_tab_fragment

    override fun initView() {
        //viewpager的adapter一定要填入getChildFragmentManager()，而不是getFragmentManager()，否则会造成fragment重复生成无法被销毁
        MainTabManager.setMainTab(bottom_navigation_bar, vp_content, childFragmentManager)
    }

    override fun initData() {

    }

    override fun startObserve() {
        mViewModel.apply {

        }
    }

}